import random
from datetime import timedelta

def generate_random_data(start_date, end_date):
    # 模拟生成一些随机数据
    data = []
    current_date = start_date
    while current_date <= end_date:
        value = random.randint(1, 100)
        category = random.choice(['A', 'B', 'C'])
        data.append({
            'date': current_date.strftime('%Y-%m-%d'),
            'value': value,
            'category': category
        })
        current_date += timedelta(days=1)
    return data

def perform_data_analysis(data):
    # 进行简单的分析：计算总值、平均值以及各类别的汇总
    total = sum([record['value'] for record in data])
    average = total / len(data) if data else 0
    categories = {'A': 0, 'B': 0, 'C': 0}
    for record in data:
        categories[record['category']] += 1

    return {
        'total': total,
        'average': average,
        'categories': categories
    }
